package com.cglib;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.stereotype.Component;

/**
 * @author fanxiao  2022/3/7
 * @since 1.0.0
 */
@Configuration
//@ComponentScan(value = "com.cglib")
@PropertySource(value = {"classpath:data.properties"})
public class AppConfig {

//	@Value("${key}")
	private String key;


	@Override
	public String toString() {
		return "AppConfig{" +
				"key='" + key + '\'' +
				'}';
	}

	@Bean
	public static BeanFactoryPostProcessor propertySourcesPlaceholderConfigurer(){
		return new PropertySourcesPlaceholderConfigurer();
	}
}